<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Proxy-apply</title>
    <script>
        function fn() {
            return '我是函数';
        }

        let newFn = new Proxy(fn, {
            apply() {
                return '函数么？';
            }
        });

        console.log(newFn());
    </script>
    <script>
        function sum(a, b) {
            return a + b;
        }

        let newSum = new Proxy(sum, {
            apply(target, context, args) {
                //console.log(target, context, args);
                // console.log(...arguments);
                return Reflect.apply(...arguments);
            }
        });

        console.log(newSum(2, 3));
    </script>
</head>

<body>

</body>

</html>